package demo2;

/**
 * @Author 12629
 * @Description：
 */
class Animal {
    public String name;
    public int age;

    static {
        System.out.println("Animal::static::{}");
    }

    {
        System.out.println("Animal::{}");
    }

    /*public Animal() {

    }*/
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("Animal(String name,int age)......");
    }
    //....

    public void eat() {
        System.out.println(name +" 正在吃饭...");
    }
}
class Dog extends Animal {
    /*public Dog() {
        super();
    }*/
    static {
        System.out.println("Dog::static::{}");
    }
    {
        System.out.println("Dog::{}");
    }
    public Dog(String name,int age) {
        super(name,age);
        System.out.println("Dog(String name,int age)......");
    }
    public void bark() {
        System.out.println(name +" 正在汪汪叫...");
    }
}
class Bird extends Animal {
    static {
        System.out.println("Bird::static::{}");
    }

    {
        System.out.println("Bird::{}");
    }

    public Bird(String name,int age) {
        super(name,age);
        System.out.println("Bird(String name,int age)......");
    }

    /*public Bird() {
        super("小鸟",1);
    }*/
    public void fly() {
        System.out.println(name+" 正在飞...");
    }
}

public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog("旺财",2);
        System.out.println("=====================");
        Dog dog2 = new Dog("旺财",2);


        //Bird bird = new Bird("小鸟",1);
    }
}